package
{
import flash.display.MovieClip;
import flash.events.Event;
import flash.display.Stage;
import flash.display.StageScaleMode;
import flash.display.StageAlign;

public class TheCanvasFLA extends MovieClip
{
	
	public var canvas:TheCanvas;
	public function TheCanvasFLA()
	{
		super();
		stage.scaleMode = StageScaleMode.NO_SCALE;
		stage.align= StageAlign.TOP_LEFT;
		var params:Object = stage.loaderInfo.parameters;
		
		init(params);
	}
	
	public function init(params:Object=null):void{
		//params: width, height, distance of grid
		this.canvas=new TheCanvas(stage.stageWidth,stage.stageHeight,50,params);
		this.canvas.x=stage.stageWidth/2;
		this.canvas.y=stage.stageHeight/2;
		
		
		this.stage.addEventListener(Event.RESIZE,resizeHandler);
		addChild(this.canvas);
		
		this.canvas.setEvents();
	}
	
	public function resizeHandler(evt:Event):void{
		this.canvas.compWidth=stage.stageWidth;
		this.canvas.compHeight=stage.stageHeight;
		this.canvas.x=stage.stageWidth/2;
		this.canvas.y=stage.stageHeight/2;
	}
	
	
}

}

